package com.idrive.service;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.location.LocationManager;
import android.os.IBinder;

import com.idrive.listener.PathTrackerLocationListener;

public class PathTrackerLocationService extends Service {
	PathTrackerLocationListener pathTrackerListener = new PathTrackerLocationListener(PathTrackerLocationService.this);

	@Override
	public void onDestroy() {
		LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
		// Register the listener with the Location Manager to receive location
		// updates
		locationManager.removeUpdates(pathTrackerListener);

	}

	@Override
	public void onStart(Intent intent, int startid) {

		// Acquire a reference to the system Location Manager
		LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
		// Register the listener with the Location Manager to receive location
		// updates
		locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, pathTrackerListener);

	}

	@Override
	public IBinder onBind(Intent intent) {

		return null;
	}
}
